# Maintainer: Antoine Martin <antoine@xpra.org>
# Contributor: Jelle van der Waa <jelle@archlinux.org>
# Contributor: Maxim Andersson <thesilentboatman@gmail.com>

pkgname="${MINGW_PACKAGE_PREFIX}-python3-zeroconf"
_srcname=python-zeroconf
pkgver=0.23.0
pkgrel=2
pkgdesc="A pure python implementation of multicast DNS service discovery"
arch=('any')
url="https://github.com/jstasiak/python-zeroconf"
license=('LGPL')
depends=("${MINGW_PACKAGE_PREFIX}-python3"
         "${MINGW_PACKAGE_PREFIX}-python3-ifaddr"
         "${MINGW_PACKAGE_PREFIX}-python3-netifaces"
         "${MINGW_PACKAGE_PREFIX}-python3-six")
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools")
checkdepends=("${MINGW_PACKAGE_PREFIX}-python3-pytest")
source=("${_srcname}-${pkgver}.tar.gz"::"https://github.com/jstasiak/${_srcname}/archive/${pkgver}.tar.gz")
sha256sums=('e194df93ae5d5158fd62434e395fe73ef9eb9580e5d326aad06d02c56031b31a')

build() {
  cd "${srcdir}/${_srcname}-${pkgver}"
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
    ${MINGW_PREFIX}/bin/python3 setup.py build
}

package() {
  cd "${srcdir}/${_srcname}-${pkgver}"

  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --prefix=${MINGW_PREFIX} \
      --root="${pkgdir}" --optimize=1 --skip-build

  install -Dm644 COPYING    "${pkgdir}${MINGW_PREFIX}/share/licenses/python3-zeroconf/COPYING"
  install -Dm644 README.rst "${pkgdir}${MINGW_PREFIX}/share/doc/python3-zeroconf/README"
}

check() {
  cd "${srcdir}/${_srcname}-${pkgver}"
  py.test .
}
